﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CreateYourWorld.DataModels
{
    public class PlayerModel
    {
        public Int64 ID { get; set; }
        public PlayerBaseModel Data { get; set; }

        public int LifePoints { get; set; }
        public int Endurance { get; set; }
        public int Strength { get; set; }
        public int Intelligence { get; set; }
        public int Dexterity { get; set; }

        public int PhysicalResistance { get; set; }
        public int MagicalResistance { get; set; }
        public int PoisonResistance { get; set; }
        public int FireResistance { get; set; }
        public int WaterResistance { get; set; }

        public Int64 FieldID { get; set; }
        public Int32 WorldID { get; set; }
        public Int32 xPosition { get; set; }
        public Int32 yPosition { get; set; }

        public List<ItemModel> Inventory { get; set; }

        public PlayerFieldModel PlayerField { get; set; }

        /// <summary>
        /// Field of view with a range of 3 Fields in each direction. 
        /// Player-position in the middle (3,3).
        /// </summary>
        public FieldModel[,] FieldOfView = new FieldModel[7, 7];
        /// <summary>
        /// sets Field-Object located relatively to player
        /// </summary>
        /// <param name="xDistanceToPlayer">horizontal position: range [-3 .. 3] in relation to player (equals 0)</param>
        /// <param name="yDistanceToPlayer">vertical position: range [-3 .. 3] in relation to player (equals 0)</param>
        /// <param name="field">FieldObject</param>
        public void setField(int xDistanceToPlayer, int yDistanceToPlayer, FieldModel field)
        {
            FieldOfView[3 + yDistanceToPlayer, 3 + xDistanceToPlayer] = field;
        }
        /// <summary>
        /// returns Field-Object located relatively to player
        /// </summary>
        /// <param name="xDistanceToPlayer">horizontal position: range [-2 .. 2] in relation to player (equals 0)</param>
        /// <param name="yDistanceToPlayer">vertical position: range [-2 .. 2] in relation to player (equals 0)</param>
        /// <returns>FieldObject at given Position</returns>
        public FieldModel getField(int xDistanceToPlayer, int yDistanceToPlayer)
        {
            return FieldOfView[3 + yDistanceToPlayer, 3 + xDistanceToPlayer];
        }
    }
}
